package com.autumn.scheduler.api.services.dto.output;

import java.util.Date;

import com.autumn.common.api.application.dto.output.DefaultGmtModifiedOutput;
import com.autumn.scheduler.api.constant.ApiConstants.ExecuteOperation;
import com.autumn.scheduler.api.constant.ApiConstants.JobIntervalUnit;
import com.autumn.scheduler.api.constant.ApiConstants.JobTriggerState;
import com.autumn.scheduler.api.constant.ApiConstants.TriggerType;
import com.autumn.util.StringUtils;

/**
 * 任务详情输出
 * 
 * @author 老码农 2018-03-20 23:28:59
 */
public class AutumnJobDetailsOutput extends DefaultGmtModifiedOutput {

	/**
	 * 
	 */
	private static final long serialVersionUID = -645893612434575017L;

	private String jobFriendlyName;
	private String jobGroup;
	private String jobQueueName;
	private long executeNumbers;
	private int executeOperation;
	private long runNumbers;
	private long runSuccessNumbers;
	private long runFailNumbers;
	private Integer timeInterval;
	private String timeIntervalUnit;
	private String cronExpression;
	private String executeParameter;
	private String jobDescription;
	private String jobClassName;
	private String triggerDescription;
	private Date firstStartTime;
	private Date previousExecuteTime;
	private Date nextExecuteTime;
	private String triggerState;
	private String triggerType;

	public String getJobFriendlyName() {
		return jobFriendlyName;
	}

	public void setJobFriendlyName(String jobFriendlyName) {
		this.jobFriendlyName = jobFriendlyName;
	}

	public String getJobGroup() {
		return jobGroup;
	}

	public void setJobGroup(String jobGroup) {
		this.jobGroup = jobGroup;
	}

	public String getJobQueueName() {
		return jobQueueName;
	}

	public void setJobQueueName(String jobQueueName) {
		this.jobQueueName = jobQueueName;
	}

	public long getExecuteNumbers() {
		return executeNumbers;
	}

	public void setExecuteNumbers(long executeNumbers) {
		this.executeNumbers = executeNumbers;
	}

	public int getExecuteOperation() {
		return executeOperation;
	}

	public void setExecuteOperation(int executeOperation) {
		this.executeOperation = executeOperation;
	}

	public long getRunNumbers() {
		return runNumbers;
	}

	public void setRunNumbers(long runNumbers) {
		this.runNumbers = runNumbers;
	}

	public long getRunSuccessNumbers() {
		return runSuccessNumbers;
	}

	public void setRunSuccessNumbers(long runSuccessNumbers) {
		this.runSuccessNumbers = runSuccessNumbers;
	}

	public long getRunFailNumbers() {
		return runFailNumbers;
	}

	public void setRunFailNumbers(long runFailNumbers) {
		this.runFailNumbers = runFailNumbers;
	}

	public Integer getTimeInterval() {
		return timeInterval;
	}

	public void setTimeInterval(Integer timeInterval) {
		this.timeInterval = timeInterval;
	}

	public String getTimeIntervalUnit() {
		return timeIntervalUnit;
	}

	public void setTimeIntervalUnit(String timeIntervalUnit) {
		this.timeIntervalUnit = timeIntervalUnit;
	}

	public String getCronExpression() {
		return cronExpression;
	}

	public void setCronExpression(String cronExpression) {
		this.cronExpression = cronExpression;
	}

	public String getExecuteParameter() {
		return executeParameter;
	}

	public void setExecuteParameter(String executeParameter) {
		this.executeParameter = executeParameter;
	}

	public String getJobDescription() {
		return jobDescription;
	}

	public void setJobDescription(String jobDescription) {
		this.jobDescription = jobDescription;
	}

	public String getJobClassName() {
		return jobClassName;
	}

	public void setJobClassName(String jobClassName) {
		this.jobClassName = jobClassName;
	}

	public String getTriggerDescription() {
		return triggerDescription;
	}

	public void setTriggerDescription(String triggerDescription) {
		this.triggerDescription = triggerDescription;
	}

	public String getTriggerState() {
		return triggerState;
	}

	public void setTriggerState(String triggerState) {
		this.triggerState = triggerState;
	}

	public String getTriggerType() {
		return triggerType;
	}

	public void setTriggerType(String triggerType) {
		this.triggerType = triggerType;
	}

	public Date getFirstStartTime() {
		return firstStartTime;
	}

	public void setFirstStartTime(Date firstStartTime) {
		this.firstStartTime = firstStartTime;
	}

	public Date getPreviousExecuteTime() {
		return previousExecuteTime;
	}

	public void setPreviousExecuteTime(Date previousExecuteTime) {
		this.previousExecuteTime = previousExecuteTime;
	}

	public Date getNextExecuteTime() {
		return nextExecuteTime;
	}

	public void setNextExecuteTime(Date nextExecuteTime) {
		this.nextExecuteTime = nextExecuteTime;
	}

	/**
	 * 获取执行后操作
	 * 
	 * @return
	 *
	 */
	public String getExecuteOperationName() {
		String value = ExecuteOperation.getMessage(this.getExecuteOperation());
		if (StringUtils.isNullOrBlank(value)) {
			return "无操作";
		}
		return value;
	}

	/**
	 * 获取状态
	 * 
	 * @return
	 *
	 */
	public String getTriggerStateName() {
		String value = JobTriggerState.getMessage(this.getTriggerState());
		if (StringUtils.isNullOrBlank(value)) {
			return "未知";
		}
		return value;
	}

	public String getTimeIntervalUnitName() {		
		return JobIntervalUnit.getIntervalUnit(this.getTimeIntervalUnit());
	}

	public String getTriggerTypeName() {
		return TriggerType.getMessage(this.getTriggerType());
	}

}
